package com.gasolinator.a.app.helper;

import java.text.DecimalFormat;

public class NumberFormats
{
    private static final DecimalFormat DECIMAL_FORMAT = new DecimalFormat("#");

    public static String distanceFormat(Double distance)
    {
//        return String.format("%.2f",distance) ;
//        return new DecimalFormat("0.00").format(distance);
        String distanceString = null;
	    if (distance<1000.0) {
	        distanceString = DECIMAL_FORMAT.format(distance) + "m";
	    } else {
	        double d=distance/1000.0;
	        distanceString = DECIMAL_FORMAT.format(d) + "km";
	    }
        return distanceString;
    }

    public static String priceFormat(Double price)
    {
        return new DecimalFormat("0.000").format(price);
    }


    public static String formatDist(float meters) {
        if (meters < 1000) {
            return ((int) meters) + "m";
        } else if (meters < 10000) {
            return formatDec(meters / 1000f, 1) + "km";
        } else {
            return ((int) (meters / 1000f)) + "km";
        }
    }
    public static String formatDec(float val, int dec) {
        int factor = (int) Math.pow(10, dec);

        int front = (int) (val);
        int back = (int) Math.abs(val * (factor)) % factor;

        return front + "." + back;
    }
}

/* Location:           /home/fjhidalgo/Escritorio/gasolinator_flips/classes.dex.dex2jar.jar
 * Qualified Name:     com.gasolinator.a.app.NumberFormats
 * JD-Core Version:    0.6.0
 */